#include "chain.h"

void ClassTeacher::handle(const Request& request)
{
    request.showRequest();
    if(request.getLeaveDays() < 3)
    {
        std::cout << "请假少于3天,批准." << std::endl;
        return;
    }
    else{
        std::cout << "当前处理不了，传递到下一级处理."<< std::endl;
        if(m_next_handler)
            m_next_handler->handle(request);
    }
}

void DepartmentLeader::handle(const Request &request)
{
    request.showRequest();
    if(request.getLeaveDays() >= 3 && request.getLeaveDays() < 7)
    {
        std::cout << "请假少于7天,批准."<< std::endl;
        return;
    }
    else{
        std::cout << "当前处理不了，传递到下一级处理."<< std::endl;
        if(m_next_handler)
            m_next_handler->handle(request);
    }
}

void VicePrincipal::handle(const Request &request)
{
    request.showRequest();
    if(request.getLeaveDays() >= 7 && request.getLeaveDays() < 14)
    {
        std::cout << "请假少于14天,批准."<< std::endl;
        return;
    }
    else{
        std::cout << "当前处理不了，传递到下一级处理."<< std::endl;
        if(m_next_handler)
            m_next_handler->handle(request);
    }
}

void Principal::handle(const Request &request)
{
    request.showRequest();
    if(request.getLeaveDays() >= 14 )
    {
        std::cout << "请假超过14天,批准."<< std::endl;
        return;
    }
}
